/*
 * ip_checksum.c
 *
 *  Created on: 2009-5-5
 *      Author: tian
 */

#include"myip.h"

unsigned short ip_checksum(const void *pheader){
	unsigned short sum=0;
	unsigned short *p=(void *)pheader;
	int size=sizeof(struct iphdr);
	while(size>0){
		sum+=*(p++);
		size-=2;
	}
	return (~sum);
}
